package com.cleaningcloud.cld.controller;

import com.cleaningcloud.cld.domain.MaterialsBI;
import com.cleaningcloud.cld.domain.SaleBI;
import com.cleaningcloud.cld.service.IMaterialsBIService;
import com.cleaningcloud.cld.service.ISaleBIService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @className 销售利润BI控制类
 * @description //TODO
 * @author Shaw
 * @date: 2025-03-05 17:07
 * @param: //TODO
 */ 
@RestController
@RequestMapping("/saleBI")
public class SaleBIController extends BaseController {

    //BI业务接口
    @Autowired
    private ISaleBIService iSaleBIService;

    /**
     * @Author Shaw
     * @Description 库存统计表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCommodityStockSaleByCommodityTypeTable")
    public AjaxResult getCommodityStockSaleByCommodityTypeTable() {
        return success(iSaleBIService.getCommodityStockSaleByCommodityTypeTable());
    }

    /**
     * @Author Shaw
     * @Description 商品公司库存占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCompanyCommodityTypeSaleRate")
    public AjaxResult getCompanyCommodityTypeSaleRate() {
        return success(iSaleBIService.getCompanyCommodityTypeSaleRate());
    }

    /**
     * @Author Shaw
     * @Description 按当月查询物资资产成本(日走势图)
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsInfoSaleDayImg")
    public AjaxResult getMaterialsInfoSaleDayImg() {
        return success(iSaleBIService.getMaterialsInfoSaleDayImg());
    }

    /**
     * @Author Shaw
     * @Description 按当月查询物资销售额/利润(月累计表格)
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsInfoSaleTable")
    public AjaxResult getMaterialsInfoSaleTable() {
        return success(iSaleBIService.getMaterialsInfoSaleTable());
    }

    /**
     * @Author Shaw
     * @Description 商品类型销售数量占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSaleCommodityTypeRate")
    public AjaxResult getSaleCommodityTypeRate() {
        return success(iSaleBIService.getSaleCommodityTypeRate());
    }

    /**
     * @Author Shaw
     * @Description 商品类型销售数量/金额表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSaleCommodityTypeTable")
    public AjaxResult getSaleCommodityTypeTable() {
        return success(iSaleBIService.getSaleCommodityTypeTable());
    }

    /**
     * @Author Shaw
     * @Description 获取销售客户销售订单占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSaleCustomerOrderRate")
    public AjaxResult getSaleCustomerOrderRate() {
        return success(iSaleBIService.getSaleCustomerOrderRate());
    }

    /**
     * @Author Shaw
     * @Description 销售订单不同状态订单数表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSaleOrderInfoTable")
    public AjaxResult getSaleOrderInfoTable() {
        return success(iSaleBIService.getSaleOrderInfoTable());
    }

    /**
     * @Author Shaw
     * @Description 根据类型ID获取公司库存数量/金额占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCompanyStockRateByCommodityTypeId")
    public AjaxResult getCompanyStockRateByCommodityTypeId(SaleBI saleBI) {
        return success(iSaleBIService.getCompanyStockRateByCommodityTypeId(saleBI));
    }

    /**
     * @Author Shaw
     * @Description 根据类型ID获取公司库存数量/金额TOP20
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCompanyStockTableByCommodityTypeId")
    public AjaxResult getCompanyStockTableByCommodityTypeId(SaleBI saleBI) {
        return success(iSaleBIService.getCompanyStockTableByCommodityTypeId(saleBI));
    }

    /**
     * @Author Shaw
     * @Description 根据类型ID获取销售成本/利润
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSaleMoneyByCommodityTypeId")
    public AjaxResult getSaleMoneyByCommodityTypeId(SaleBI saleBI) {
        return success(iSaleBIService.getSaleMoneyByCommodityTypeId(saleBI));
    }

    /**
     * @Author Shaw
     * @Description 根据类型ID获取销售数量/金额TOP20
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getLevelSaleTableByCommodityTypeId")
    public AjaxResult getLevelSaleTableByCommodityTypeId(SaleBI saleBI) {
        return success(iSaleBIService.getLevelSaleTableByCommodityTypeId(saleBI));
    }
}
